import { QXEvent } from "qx-util";
import { IParam, ListActionType, IListAbility, IListControllerParams, IListStore, ListController, ICtrlEvent, IListController, IListModel } from "@/core";
import { useListAction, useListBasic, useListControllerParams, useListProps } from "@/hooks/widget/use-list";
import { Dashboard_sysportlet7_listControlVO } from './order-details-money-list-vo';
import { model } from "./order-details-money-list-model";
import ListService from "@/core/modules/ctrl-service/list-service";
// 基于template/src/widgets/{{appEntities}}/{{ctrls@List}}-list/{{spinalCase ctrl.codeName}}-list-hook.ts.hbs生成
/**
 * 获取输入参数
 *
 * @export
 * @return {*}
 */
export function useProps() {
	return {
		...useListProps(),
	};
}

/**
 * 获取基础数据
 *
 * @export
 * @param {*} props
 * @return {*}
 */
export function useBasic(props: any) {
	return {
		...useListBasic(model, props),
	};
}

/**
 * 获取行为
 *
 * @export
 */
export function useAction(controller: any) {
	return {
		...useListAction(controller),
	};
}

/**
 * 获取控制器
 *
 * @export
 * @param {IParam} props
 * @param {QXEvent<ICtrlEvent<ListActionType, IListAbility>>} evt
 * @return {*}
 */
export function useController(
	props: IParam,
	evt: QXEvent<ICtrlEvent<ListActionType, IListAbility>>,
    otherParams: IParam = {},
): IListController<IListStore, IListAbility> {
	const params: IListControllerParams<ListActionType, IListAbility> =
		useListControllerParams<IListStore, IListModel>(model, props, evt, otherParams);
    const ctrlService = new ListService<Dashboard_sysportlet7_listControlVO>(Dashboard_sysportlet7_listControlVO, model.entityCodeName, { model });
  	Object.assign(params, { ctrlService });
  	return new ListController(params);
}